#ifndef LOGGER_H
#define LOGGER_H

#include <fstream>
#include <iostream>
#include <mutex>
#include <string>
#include <ctime>

enum class LogLevel{
    DEBUG,
    INFO,
    WARNING,
    ERROR
};

class Logger{
public:
    static void init(const std::string& filename, LogLevel level = LogLevel::INFO);
    static void log(LogLevel level, const std::string &message);
    static void debug(const std::string& message);
    static void info(const std::string &message);
    static void warning(const std::string &message);
    static void error(const std::string &message);

private: 
    static Logger &getInstance();
    Logger(const std::string& fielname, LogLevel level);
    Logger(const Logger&) = delete;
    Logger& operator=(const Logger&) = delete;

    std::ofstream file_;
    LogLevel level_;
    std::mutex mutex_;
    static Logger* instance_;
};

#endif // LOGGER_H